/**
 * 此js文件管理关于当前设备的机型系统信息
 */
export default function systemInfo() {
  /****************** 所有平台共有的系统信息 ********************/
  // 设备系统信息
  let systemInfomations = uni.getSystemInfoSync();
  // DPR
  let dpr = systemInfomations.devicePixelRatio;
  // 机型适配比例系数
  let scaleFactor = 750 / systemInfomations.windowWidth;
  // 当前机型-屏幕高度
  let windowHeight = systemInfomations.windowHeight;
  // 当前机型-屏幕宽度
  let windowWidth = systemInfomations.windowWidth;
  // 屏幕高度
  let screenHeight = systemInfomations.screenHeight;
  // 屏幕宽度
  let screenWidth = systemInfomations.screenWidth;
  // 状态栏高度
  let statusBarHeight = systemInfomations.statusBarHeight;
  // 苹果的安全区域
  let safeAreaInsets = systemInfomations.safeAreaInsets;
  let safeArea = systemInfomations.safeArea;

  /****************** 微信小程序头部胶囊信息 ********************/
  // #ifdef MP-WEIXIN
  const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
  // 胶囊高度
  let menuButtonHeight = menuButtonInfo.height;
  // 胶囊宽度
  let menuButtonWidth = menuButtonInfo.width;
  // 胶囊上边界的坐标
  let menuButtonTop = menuButtonInfo.top;
  // 胶囊右边界的坐标
  let menuButtonRight = windowWidth - menuButtonInfo.right;
  // 胶囊下边界的坐标
  let menuButtonBottom = menuButtonInfo.bottom;
  // 胶囊左边界的坐标
  let menuButtonLeft = menuButtonInfo.left;
  // #endif

  // #ifdef MP-WEIXIN
  return {
    dpr,
    scaleFactor,
    windowHeight,
    windowWidth,
    screenHeight,
    screenWidth,
    statusBarHeight,
    menuButtonHeight,
    menuButtonWidth,
    menuButtonTop,
    menuButtonRight,
    menuButtonBottom,
    menuButtonLeft,
    safeAreaInsets,
    safeArea,
  };
  // #endif

  // #ifndef MP-WEIXIN
  return {
    dpr,
    scaleFactor,
    windowHeight,
    windowWidth,
    screenHeight,
    screenWidth,
    statusBarHeight,
    safeAreaInsets,
    safeArea,
  };
  // #endif
}
